[javascript] Populating jsTree based on XML data uploaded to server folder

Posted by PFM on Stack Overflow See other posts from Stack Overflow or by PFM
Published on 2011-01-03T19:03:11Z Indexed on 2011/01/03 21:54 UTC
Read the original article Hit count: 193

Filed under:
|
|

tl:dr How can I populate jsTree based on a folder location instead of an exact XML url?

I'm looking for a little direction on this project.

Currently I am trying to copy file structures of hard drives as XML files and recreate them using jsTree on the webserver for a completely independent version of the file structure. I have some python script that outputs XML files that are formed to jsTree and automatically uploads to a folder on the server. The problem is now I am a little lost because I have to manually enter each XML file into jsTree code for it to display so I have multiple entries like this:

 $("#tree1")
   .jstree({ 
       "plugins" : [ "themes", "xml_data", "ui", "search", "types" ],
        "xml_data" : {      
            "ajax" : {
                "url" : "./XML_DATA/DRIVE1.xml"
                     },
                        "xsl" : "nest" 
                     },

I see in the documentation that instead of populated by the direct file the folders are populated by "server.php" but no where in the php code does it point to any directories or files. After considering the problem I thought of a few solutions and could use some advice on them:

Should I be trying to write php code to automatically look through my XML_DATA folder to upload each XML file? Should I just upload all the XML to mySQL and populate my tree based on that? Should the javascript be the code looking through the server's folder for XML files?

All the XML is formed the same way but the number of XML files on the server will increase and will have to be refreshed as well as they will be overwritten with changes. Any direction would be appreciated, thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript